class CreditItemsController < ApplicationController
  def index
    @credit_items = CreditItem.all
  end

  def show
    @credit_item = CreditItem.find(params[:id])
  end

  def new
    @credit_item = CreditItem.new
  end

  def create
    @credit_item = CreditItem.new(params[:credit_item])
    if @credit_item.save
      redirect_to @credit_item, :notice => "Successfully created credit item."
    else
      render :action => 'new'
    end
  end

  def edit
    @credit_item = CreditItem.find(params[:id])
  end

  def update
    @credit_item = CreditItem.find(params[:id])
    if @credit_item.update_attributes(params[:credit_item])
      redirect_to @credit_item, :notice  => "Successfully updated credit item."
    else
      render :action => 'edit'
    end
  end

  def destroy
    @credit_item = CreditItem.find(params[:id])
    @credit_item.destroy
    redirect_to credit_items_url, :notice => "Successfully destroyed credit item."
  end
end
